package us.kg.kotoriforest.servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet(value = "/noneServiceServlet", loadOnStartup = 114514)
public class NoneServiceServlet extends HttpServlet {
    /*
     * do nothing
     * 会执行 HttpServlet 中的 service 方法
     * 即故意向客户端发送 405 错误 （请求方式不允许）
     * */

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("收到了 get 请求");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("收到了 post 请求");
    }
}
